debug: bool,
test: bool,
dest: Option<String>,
+ plugin: bool,
}
impl Profile {
opt_level: 0,
debug: true,
test: false, // whether or not to pass --test
- dest: None
+ dest: None,
+ plugin: false,
}
}
opt_level: 0,
debug: true,
test: true, // whether or not to pass --test
- dest: Some("test".to_string())
+ dest: Some("test".to_string()),
+ plugin: false,
}
}
opt_level: 3,
debug: false,
test: true, // whether or not to pass --test
- dest: Some("bench".to_string())
+ dest: Some("bench".to_string()),
+ plugin: false,
}
}
opt_level: 3,
debug: false,
test: false, // whether or not to pass --test
- dest: Some("release".to_string())
+ dest: Some("release".to_string()),
+ plugin: false,
}
}
self.test
}
+ pub fn is_plugin(&self) -> bool {
+ self.plugin
+ }
+
pub fn get_opt_level(&self) -> uint {
self.opt_level
}
self.test = test;
self
}
+
+ pub fn plugin(mut self, plugin: bool) -> Profile {
+ self.plugin = plugin;
+ self
+ }
}
#[deriving(Clone, Hash, PartialEq)]
name: String,
src_path: Path,
profile: Profile,
- metadata: Option<Metadata>
+ metadata: Option<Metadata>,
}
#[deriving(Encodable)]
use toml;
use core::{SourceId, GitKind};
-use core::manifest::{LibKind, Lib, Profile};
+use core::manifest::{LibKind, Lib, Dylib, Profile};
use core::{Summary, Manifest, Target, Dependency, PackageId};
use core::package_id::Metadata;
use core::source::Location;
name: name.to_string(),
crate_type: None,
path: Some(lib.display().to_string()),
- test: None
+ test: None,
+ plugin: None,
}]
})
}
name: name,
crate_type: None,
path: Some(bin.display().to_string()),
- test: None
+ test: None,
+ plugin: None,
}
})
}).collect())
name: t.name.clone(),
crate_type: t.crate_type.clone(),
path: layout.lib.as_ref().map(|p| p.display().to_string()),
- test: t.test
+ test: t.test,
+ plugin: t.plugin,
}
} else {
t.clone()
name: t.name.clone(),
crate_type: t.crate_type.clone(),
path: bin.as_ref().map(|p| p.display().to_string()),
- test: t.test
+ test: t.test,
+ plugin: None,
}
} else {
t.clone()
name: String,
crate_type: Option<Vec<String>>,
path: Option<String>,
- test: Option<bool>
+ test: Option<bool>,
+ plugin: Option<bool>,
}
fn normalize(lib: Option<&[TomlLibTarget]>,
fn target_profiles(target: &TomlTarget,
dep: Option<TestDep>) -> Vec<Profile> {
- let mut ret = vec!(Profile::default_dev(), Profile::default_release());
+ let mut ret = vec![Profile::default_dev(), Profile::default_release()];
match target.test {
Some(true) | None => ret.push(Profile::default_test()),
_ => {}
}
+ if target.plugin == Some(true) {
+ ret = ret.move_iter().map(|p| p.plugin(true)).collect();
+ }
+
ret
}
let path = l.path.clone().unwrap_or_else(|| format!("src/{}.rs", l.name));
let crate_types = l.crate_type.clone().and_then(|kinds| {
LibKind::from_strs(kinds).ok()
- }).unwrap_or_else(|| vec!(Lib));
+ }).unwrap_or_else(|| {
+ vec![if l.plugin == Some(true) {Dylib} else {Lib}]
+ });
for profile in target_profiles(l, Some(dep)).iter() {
dst.push(Target::lib_target(l.name.as_slice(), crate_types.clone(),